package com.yex.modules.job.task;

import com.yex.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Little Liu
 * @version V1
 * @date Created in 2019/1/2 15:44
 * @description 描述
 */
@Component("orderTask")
public class OrderTask {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private OrderService orderService;
    @Autowired
    private MessageService messageService;
    @Autowired
    private InvestmentOrderService investmentOrderService;
    @Autowired
    private UserService userService;
    @Autowired
    private RedemptionService redemptionService;
    @Autowired
    private DynamicLogService dynamicLogService;

    public void orderOvertime() {
        try {
            logger.info("订单超时执行=====start");
            orderService.updateOrderOvertime();
            logger.info("订单超时执行=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void sendMessage() {
        try {
            logger.info("未发送成功的短信=====start");
            messageService.updateMessageTask();
            logger.info("未发送成功的短信=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void intro() {
        try {
            logger.info("更新Intro=====start");
            userService.updateIntro();
            logger.info("更新Intro=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void introInvestmentOrder() {
        try {
            logger.info("更新introInvestmentOrder=====start");
            investmentOrderService.updateIntroInvestmentOrder();
            logger.info("更新introInvestmentOrder=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void investmentOrder() {
        try {
            logger.info("更新investmentOrder=====start");
            investmentOrderService.updateInvestmentOrder();
            logger.info("更新investmentOrder=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void investment() {
        try {
            logger.info("更新investment=====start");
            investmentOrderService.updateInvestment();
            logger.info("更新investmentOrder=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void redemption() {
        try {
            logger.info("更新redemption=====start");
            redemptionService.updateRedemption();
            logger.info("更新redemption=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void autoInvestment() {
        try {
            logger.info("更新autoInvestment=====start");
            investmentOrderService.updateAutoInvestment();
            logger.info("更新autoInvestment=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void leaderInvestment() {
        try {
            logger.info("更新leaderInvestment=====start");
            investmentOrderService.updateLeaderInvestment();
            logger.info("更新leaderInvestment=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void leader() {
        try {
            logger.info("更新leader=====start");
            dynamicLogService.updateLeader();
            logger.info("更新leader=====end");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
